<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      layout:decorator="includes/layout">

<div layout:fragment="sidebar" th:replace="includes/sidebar :: test"></div>

<div layout:fragment="content">
    <button class="layui-btn layui-btn-normal" th:onclick="|Home.initProject()|">初始化项目</button>
</div>

<div layout:fragment="js"></div>
<script type="text/javascript" src="/res/js/home.js"></script>
<div layout:fragment="js">
    <script type="text/javascript">
        var Home = {};

        layui.use(['element', 'layer', 'table'], function() {
            var $ = layui.jquery,
                    layer = layui.layer,
                    table = layui.table;

            // 初始化项目
            Home.initProject = function() {
                layer.confirm('初始化会覆盖之前的设置，确认初始化吗？', function(index) {
                    if(index) {
                        $.post("/api/initProject", {
                            "projectConfigId": Main.projectConfigId
                        }, function(res) {
                            console.log(res);
                        });
                    }

                    layer.close(index);
                });
            }
        });
    </script>
</div>
</html>